﻿<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ page import="com.CGFrame.struts.POJOs.Shot"%>
<%@ page import="com.CGFrame.struts.POJOs.Element"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> 
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%
	String path = request.getContextPath();
%>
<html:html>
<head>
	<META http-equiv=Content-Type content="text/html; charset=utf-8">
	<LINK href="styles/stylewang.css"  type=text/css rel=stylesheet>
	<LINK href="../styles/stylewang.css"  type=text/css rel=stylesheet>
	<style type="text/css"></style>
	<title>CGProject</title>
	<html:base/>
    <script language=javascript>
			function Add(){
				var addrow=document.getElementById("AddNote");
				<%
					Object shot=request.getAttribute("Shot");
					if(shot!=null){
						shot=(Shot)shot;
				%>
				addrow.innerHTML="<form action='addComments.do?shotId=<bean:write name="Shot" property="shotId"/>' method='POST'><textarea name='note' size='100%' length='200' type='text'></textarea> <input type='submit'  value='Submit'><a href='javascript:back()' >Cancel</a>";
				<%}
					Object ele=request.getAttribute("Element");
					if(ele!=null){
						ele=(Element)ele;
				%>
				addrow.innerHTML="<form action='addComments.do?elementId=<bean:write name="Element" property="elementId"/>' method='POST'><textarea name='note' size='100%' length='200' type='text'></textarea> <input type='submit'  value='Submit'><a href='javascript:back()' >Cancel</a>";
				<%}%>
			}
			
			function toElement(id){
				var value="Type=Element&amp;ObjectID="+id;
				if(navigator.appName=="Microsoft Internet Explorer"){
					top.B.location.href="<%=path%>/frame.do?Frame=12&Id=16&"+value;
				}else{
					value = value.replace(/&amp\;/g,"&");
					top.B.location.href="<%=path%>/frame.do?Frame=12&Id=16&"+value;
				}
			}
			function toShot(id){
				var value="Type=Shot&amp;ObjectID="+id;
				if(navigator.appName=="Microsoft Internet Explorer"){
					top.B.location.href="<%=path%>/frame.do?Frame=12&Id=16&"+value;
				}else{
					value = value.replace(/&amp\;/g,"&");
					top.B.location.href="<%=path%>/frame.do?Frame=12&Id=16&"+value;
				}
			}
			
			var xhr;
			function createXHR(){
				if(window.ActiveXObject){
					xhr=new ActiveXObject("Microsoft.XMLHTTP");
				}else if(window.XMLHttpRequest){
					xhr=new XMLHttpRequest();
				}
			}
			function queryComment(id){
				// 如果有comment，则显示，没有则请求服务器
				if(document.getElementById("comment"+id)){
					// 给comment的table自定义了isComments属性
					var tables=document.getElementsByTagName("table");
					var comments=new Array();
					for(var j=0;j<tables.length;j++){
						if(tables[j].getAttribute("isComments")){
							comments.push(tables[j]);
						}
					}
					for(var i=0;i<comments.length;i++){
						comments[i].style.display="none";
					}
					document.getElementById("comment"+id).style.display="";
				}else{
					createXHR();
					var date = new Date();
					xhr.open("GET","getComments.do?makeId="+id+"&Date="+date.getTime());
					xhr.send(null);
					xhr.onreadystatechange=handleReadyState;
				}
			}
			function handleReadyState(){
				if(xhr.readyState==4){
					if(xhr.status==200){
						parseResult();					
					}
				}
			}
			function parseResult(){
				// 给comment的table自定义了isComments属性
				var tables=document.getElementsByTagName("table");
				var comments=new Array();
				for(var j=0;j<tables.length;j++){
					if(tables[j].getAttribute("isComments")){
						comments.push(tables[j]);
					}
				}
				for(var i=0;i<comments.length;i++){
					comments[i].style.display="none";
				}
				var divc=document.getElementById("divcontent");
				divc.innerHTML+=xhr.responseText;
			}
			function showComment(){
				//不显示所有评论
				var tables=document.getElementsByTagName("table");
				for(var j=0;j<tables.length;j++){
					if(tables[j].getAttribute("isComments")){
						tables[j].style.display="none";
					}
				}
				//显示镜头的评论
				document.getElementById("commentTable").style.display="";
			}
     </script>
</head>
<body>
<logic:equal name="Type" value="Project">
	<table border="0" width="100%" cellspacing="0" id="table6">
		
		<tr >
			<td  width="20%" id="btleftbian">&nbsp;
				<bean:message key="project.name"/>
			</td>
			<td width="80%" id="rightcenter">&nbsp;
				<bean:write name="Project" property="projectName"/>
			</td>
		</tr>
		<tr>
			<td width="20%" id="btleftbian">&nbsp;
				<bean:message key="project.description"/>
			</td>
			<td  width="80%" id="rightcenter">&nbsp;
				<bean:write name="Project" property="description"/>
			</td>
		</tr>
		<tr>
			<td width="20%" id="btleftbian">&nbsp;
				<bean:message key="project.createtime"/>
			</td>
			<td width="80%" id="rightcenter">&nbsp;
				<bean:write name="Project" property="projectCreated"/>
			</td>
		</tr>
		<tr>
			<td width="20%" id="btleftbian">&nbsp;
				<bean:message key="project.planstarttime"/>
			</td>
			<td width="80%" id="rightcenter">&nbsp;
				<bean:write name="Project" property="planStartTime" format="yyyy-MM-dd"/>
			</td>
		</tr>
		<tr>
			<td width="20%" id="btleftbian">&nbsp;
				<bean:message key="project.planfinishtime"/>
			</td>
			<td  width="80%" id="rightcenter">&nbsp;
				<bean:write name="Project" property="planFinishTime" format="yyyy-MM-dd"/>
			</td>
		</tr>
		
		<tr>
			<td width="20%" id="btleftbian">&nbsp;
				<bean:message key="project.totalshots"/>
			</td>
			<td width="80%" id="rightcenter">&nbsp;
				<bean:write name="totalshots" />
			</td>
		</tr>
		<tr>
			<td width="20%" id="btleftbian">&nbsp;
				<bean:message key="project.shotsassigned"/>
			</td>
			<td width="80%" id="rightcenter">&nbsp;
				<bean:write name="shotassigned" />
			</td>
		</tr>
		<tr>
			<td width="20%" id="btleftbian">&nbsp;
				<bean:message key="project.shotsnotassigned"/>
			</td>
			<td width="80%" id="rightcenter">&nbsp;
				<bean:write name="shotsnotassigned" />
			</td>
		</tr>
		<tr>
			<td width="20%" id="btleftbian">&nbsp;
				<bean:message key="project.shotsfinished"/>
			</td>
			<td width="80%" id="rightcenter">&nbsp;
				<bean:write name="shotsfinished" />
			</td>
		</tr>
		<tr>
			<td width="20%" id="btleftbian">&nbsp;
				<bean:message key="project.shotsnotfinished"/>
			</td>
			<td width="80%" id="rightcenter">&nbsp;
				<bean:write name="shotsnotfinished" />
			</td>
		</tr>
		<tr><td id="tdtop" colspan="2">&nbsp;</td></tr>
	</table>
</logic:equal>
<logic:equal name="Type" value="Elementgroup">
	<table border="0" width="100%" cellspacing="0" id="table6" >
		
		<logic:notEmpty name="EGP" property="elementgroups">
		<tr>
			<td width="100%" id="onlybt">&nbsp;
				<bean:message key="elementgroups"/>:
			</td>
		</tr>
		<logic:iterate name="EGP" property="elementgroups" id="element">
		<tr>
			<td width="100%" id="rightcenter">&nbsp;
				<bean:write name="element" property="elementGroupName"/>
			</td>
		</tr>
		</logic:iterate>
		</logic:notEmpty>
		<tr>
         <table width="100%" border="0" cellspacing="0" cellpadding="0" id="tdtop">
            <tr>
              <td></td>
           </tr>
         </table>
        </tr>
	
  	</table>
  <logic:notEmpty name="EGP" property="elements">
		<table border="0" width="100%" cellspacing="0" cellpadding="0" id="table6" >
		<tr>
			<td width="100%" id="onlybt">&nbsp;
				<bean:message key="elements"/>:
			</td>
		</tr>

		<logic:iterate name="EGP" property="elements" id="element">
		<tr>
			<td width="100%" id="rightcenter">&nbsp;
				<bean:write name="element" property="elementName"/>
			</td>
		</tr>
		
		</logic:iterate>
		
<tr>
         <table width="100%" border="0" cellspacing="0" cellpadding="0" id="tdtop">
            <tr>
              <td></td>
           </tr>
         </table>
        </tr>
	</table>
        </logic:notEmpty></logic:equal>
<logic:equal name="Type" value="Shotgroup">
	<table border="0" width="100%" cellspacing="0" id="table6">
		
		<logic:notEmpty name="SGP" property="shotgroups">
		<tr>
			<td colspan="6" width="100%" id="onlybt">&nbsp;
				  <bean:message key="shotgroups"/>:
			</td>
		</tr>

		<logic:iterate name="SGP" property="shotgroups" id="element">
		<tr>
			<td colspan="5" width="100%" id="rightcenter">&nbsp;
				<bean:write name="element" property="shotGroupName"/>
			</td>
		</tr>
		</logic:iterate><tr>
         <table width="100%" border="0" cellspacing="0" cellpadding="0" id="tdtop">
            <tr>
              <td></td>
             </tr>
         </table>
        </tr>
		</logic:notEmpty>
		
		<logic:notEmpty name="SGP" property="shots">
		<tr>
			<td colspan="6" width="100%" id="onlybt">&nbsp;
				<bean:message key="shots"/>:
			</td>
		</tr>
		<tr>
			<td width="10%" id="leftcenter"><b>&nbsp;<bean:message key="shot.name"/></b></td>
			<td width="10%" id="leftcenter"><b>&nbsp;<bean:message key="shot.status"/></b></td>
			<td width="15%" id="leftcenter"><b>&nbsp;<bean:message key="shot.totalframe"/></b></td>
			<td width="15%" id="leftcenter"><b>&nbsp;<bean:message key="shot.planstart"/></b></td>
			<td width="15%" id="leftcenter"><b>&nbsp;<bean:message key="shot.planend"/></b></td>
			<td width="15%"id="rightcenter"><b>&nbsp;<bean:message key="shot.description"/></b></td>
		</tr>
		<logic:iterate name="SGP" property="shots" id="element">
		<tr>
			<td width="10%" id="leftcenter">&nbsp;<bean:write name="element" property="shotName"/></td>
			<td width="10%" id="leftcenter">&nbsp;
		<script language=javascript>
			var s=top.changeColor("<bean:write name="element" property="status.statusDisplay"/>");
			document.write(s);
		</script>
		</td>
			<td width="15%" id="leftcenter">&nbsp;<bean:write name="element" property="shotTotalFrameNum"/></td>
			<td width="15%" id="leftcenter">&nbsp;<bean:write name="element" property="planStartTime"/></td>
			<td width="15%" id="leftcenter">&nbsp;<bean:write name="element" property="planEndTime"/></td>
			<td width="15%" id="rightcenter">&nbsp;<bean:write name="element" property="shotDescription"/></td>
		</tr>
		</logic:iterate><tr><td colspan="6">
         <table width="100%" border="0" cellspacing="0" cellpadding="0" id="tdtop">
            <tr>
              <td></td>
             </tr>
         </table></td>
        </tr>
		</logic:notEmpty>
	</table>
</logic:equal>
<logic:equal name="Type" value="Shot">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" >
	<table border="0" width="100%" cellspacing="0" cellpadding="0" id="table6">
		
	  <tr>
			<td width="100%"  height="60">
			<table border="0" height="100%"width="100%"  cellspacing="0" id="table7">
			<tr>
			<td width="70%" rowspan="2" valign="top" >
			<iframe id="ShotElement" name="ShotElement" align=top  marginwidth="0" marginheight="0" width="100%" border="0" frameborder="0" height="100%" src="shotElement.do?ID=<bean:write name="Shot" property="shotId"/>"></iframe>			</td>
			<td width="30%" valign="top">	
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td id="rightcenter">&nbsp;<b><bean:message key="shot.name"/>:</b>&nbsp;<bean:write name="Shot" property="shotName"/></td>
  </tr>
  <tr>
    <td id="rightcenter">&nbsp;<b>Edit:</b>&nbsp;<bean:write name="Shot" property="edit"/></td>
  </tr>
  <tr>
    <td id="rightcenter">&nbsp;<b><bean:message key="shot.planstart"/>:</b>&nbsp;<bean:write name="Shot" property="planStartTime" format="yyyy-MM-dd"/></td>
  </tr>
  <tr>
    <td id="rightcenter">&nbsp;<b><bean:message key="shot.planend"/>:</b>&nbsp;
      <bean:write name="Shot" property="planEndTime" format="yyyy-MM-dd"/></td>
  </tr>
  <tr>
    <td id="rightcenter">&nbsp;<b><bean:message key="shot.totalframe"/>:</b>&nbsp;
      <bean:write name="Shot" property="shotTotalFrameNum" /></td>
  </tr>
  <tr><td id="tdtop">&nbsp;</td></tr>
 </table>		</td>
			</tr>
</table>			</td>
	  </tr>
		<tr>
			<td align="left" valign="top" ><table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="20%" valign="top">
	   <table width=99%  cellpadding="0" cellspacing="0" border="0">
					<tr>
					<td colSpan=2 width="100%" id="onlybt">
						<a title="点击查看预览文件" href="javascript:window.location.href='<%=path%>/detail/shotDetail.do?ShotID=<bean:write name="Shot" property="shotId"/>';parent.toShot('<bean:write name="Shot" property="shotId"/>');parent.showComment();" target="details"><u>						
						<bean:write name="Shot" property="shotName"/><bean:message key="shot.makes"/>
						</u></a></td>
					</tr>
					<logic:iterate name="Makes" id="element">
					<tr>
						<td id="leftcenter">
							<a href="javascript:window.location.href='<%=path%>/detail/makeIndex.do?MakeID=<bean:write name="element" property="makeId"/>';parent.queryComment('<bean:write name="element" property="makeId"/>');" target="details">
							<u><bean:write name="element" property="makeName"/></u>
							</a>
						</td>
						<td id="rightcenter">&nbsp;					
							<script language=javascript>
								var s=top.changeColor("<bean:write name="element" property="status.statusDisplay"/>");
								document.write(s);
							</script>
						</td>
					</tr>
					</logic:iterate><tr><td id="tdtop" colspan="2">&nbsp;</td></tr>
				</table>
	 </td>
    <td valign="top" ><iframe id="sDetails" name="details" marginwidth="0" marginheight="0" width="99%" height="300" border="0" src="shotDetail.do?ShotID=<bean:write name="Shot" property="shotId"/>"  frameborder="0" ></iframe></td>
  </tr>
</table>
</td>
			</tr>
	</table>
		</td>
	<td width="5%"  valign="top">
	<div class="divcontent" id="divcontent"><table border="0" width="200" cellspacing="0" id="commentTable" cellpadding="0" isComments=true>
 			 
			  <tr>
			  	<td width="40%" id="btleftbian">
					&nbsp;<b><bean:message key="name"/></b></td>
				<td colspan="2" id="btrightbian">
					<b><bean:message key="time"/></b>					</td>
			  </tr>
			 <logic:iterate id="comments" name="ShotComments">
			  <tr>
			   <td width="40%" id="leftcenter">&nbsp;
				<bean:write name="comments" property="reguser.regName"/></td>
				
				<td id="rightcenter">&nbsp;<font color="#666666"><bean:write name="comments" property="commentTime" format="yyyy-MM-dd HH:mm" /></font></td>
			  </tr>
			  <tr><Td colspan="2" id="rightcenter">&nbsp;<font color="#990000"><bean:write name="comments" property="comment"/></font></Td></tr>
			  </logic:iterate>
			  <tr><td colspan="4">
         <table width="100%" border="0" cellspacing="0" cellpadding="0" id="tdtop">
            <tr>
              <td></td>
             </tr>
         </table></td>
        </tr>
			  <tr>
			  <td  colspan="4" id ="AddNote" height="50" maxLength="500" cellspacing="5" width="20%" ><input type='button' Value="AddNote" onClick="Add()"/></td>
			 </tr>
		</table></div>
    </td>
		
		
	  </tr>
	</table>
</logic:equal>
	<logic:equal name="Type" value="Element">
		<table width="100%" cellpadding="0" cellspacing="0">
			<tr>
				<td width="81%" valign="top">
					<table border="0"  width="100%" cellspacing="0"
						id="table6" cellpadding="0">
						<tr >
							<td colspan=2>
								<table border="0"  width="100%" cellspacing="0"
									id="table7">
									<tr>
										<td width="75%" valign="top">
											<iframe name="ShotElement" align=top marginwidth="0"
												marginheight="0" width="100%" border="0" frameborder="0"
												src="elementShot.do?ID=<bean:write name="Element" property="elementId"/>"></iframe>
										</td>
										<td width="25%" valign="top">
											<table cellspacing="0" width="100%">
												<tr>
													<td>
														<table border="0" cellspacing="0" cellpadding="0"
															width="100%">
															<tr>
																<td id="rightcenter">
																	&nbsp;
																	<b><bean:message key="element.name" /> </b>:&nbsp;&nbsp;
																	<bean:write name="Element" property="elementName" />
																</td>
															</tr>
															<tr>
																<td id="rightcenter">
																	&nbsp;
																	<b><bean:message key="shortname" /> </b>:&nbsp;&nbsp;
																	<bean:write name="Element" property="shortening" />
																</td>
															</tr>
															<tr>
																<td id="rightcenter">
																	&nbsp;
																	<b><bean:message key="element.planstarttime" /> </b>:&nbsp;&nbsp;
																	<bean:write name="Element" property="planStartTime"
																		format="yyyy-MM-dd" />
																</td>
															</tr>
															<tr>
																<td id="rightcenter">
																	&nbsp;
																	<b><bean:message key="element.planendtime" /> </b>:&nbsp;&nbsp;
																	<bean:write name="Element" property="planEndTime"
																		format="yyyy-MM-dd" />
																</td>
															</tr>
															<tr>
																<td id="tdtop">
																	&nbsp;
																</td>
															</tr>
														</table>

													</td>
												</tr>
											</table>
										</td>
									</tr>
								</table>
							</td>
						</tr>
						<tr>
							<td align="left" valign="top">
								<table width="100%" border="0" cellspacing="0" cellpadding="0">
									<tr>
										<td width=20% valign="top">
											<table width=99% border="0" cellspacing="0" cellpadding="0">
												<tr>
													<td colSpan=2 width="100%" id="onlybt">
														<a  title="点击查看预览文件"
															href="javascript:window.location.href='<%=path%>/detail/elementDetail.do?ElementID=<bean:write name="Element" property="elementId"/>';parent.toElement('<bean:write name="Element" property="elementId"/>');parent.showComment();"
															target="details"> <u><bean:write name="Element"
																	property="elementName" /> <bean:message
																	key="element.makes" /> </u> </a>
													</td>
												</tr>
												<logic:iterate name="Makes" id="element">
													<tr>
														<td id="leftcenter">
															<a
																href="javascript:window.location.href='<%=path%>/detail/makeIndex.do?MakeID=<bean:write name="element" property="makeId"/>';parent.queryComment('<bean:write name="element" property="makeId"/>');"
																target="details"> <u><bean:write name="element"
																		property="makeName" /> </u> </a>
														</td>
														<td id="rightcenter">
															&nbsp;

															<script language=javascript>
									var s=top.changeColor("<bean:write name="element" property="status.statusDisplay"/>");
									document.write(s);
								</script>
														</td>
													</tr>
												</logic:iterate>
												<tr>
													<td colspan="2">
														<table width="100%" border="0" cellspacing="0"
															cellpadding="0" id="tdtop">
															<tr>
																<td></td>
															</tr>
														</table>
													</td>
												</tr>
											</table>
										</td>
										<td valign="top">
											<iframe name="details" marginwidth="0" marginheight="0"
												width="99%" height="300"
												src="elementDetail.do?ElementID=<bean:write name="Element" property="elementId"/>"
												border="0" frameborder="0"></iframe>
										</td>
									</tr>
								</table>
							</td>

						</tr>
					</table>
				</td>
				<td width="19%" valign="top">
					<div class="divcontent" id="divcontent">
						<table border="0" width="100%" cellspacing="0" id="commentTable"
							cellpadding="0" isComments=true>
							<tr>
								<td colspan="2" >
								</td>
							</tr>
							<tr>
								<td width="20%" id="btleftbian">
									&nbsp;
									<b><bean:message key="name" />
									</b>
								</td>
								<td id="btrightbian">
									&nbsp;
									<b><bean:message key="time" />
									</b>
								</td>
							</tr>
							<logic:iterate id="comments" name="ElementComments">
								<tr>
									<td width="30%" id="leftcenter">
										&nbsp;
										<bean:write name="comments" property="reguser.regName" />
									</td>
									<td width="70%" id="rightcenter">
										&nbsp;
										<font color="#666666"><bean:write name="comments"
												property="commentTime" format="yyyy-MM-dd HH:mm" />
										</font>
									</td>

								</tr>
								<tr>
									<td id="rightcenter" colspan="2">
										&nbsp;
										<font color="#990000"><bean:write name="comments"
												property="comment" />
										</font>
									</td>
								</tr>
							</logic:iterate>
							<tr>
								<td colspan="2">
									<table width="100%" border="0" cellspacing="0" cellpadding="0"
										id="tdtop">
										<tr>
											<td></td>
										</tr>
									</table>
								</td>
							</tr>
							<tr>
								<td colspan="4" align="left" width="20%" id="AddNote">
									<input name="button" type='button' onClick="Add()"
										value="AddNote" />
								</td>
							</tr>
						</table>
					</div>
				</td>
			</tr>
		</table>
	</logic:equal>
</body>
</html:html>